<template>
  <a-config-provider :locale="locale">
    <a-spin :spinning="userStore.globalLoading" style="max-height: 100vh">
      <div id="app">
        <router-view />
      </div>
    </a-spin>
  </a-config-provider>
</template>

<script setup lang="ts">
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import { useUserStore } from '@/store/modules/user'
import { useOem } from '@/store/modules/oem'
const userStore = useUserStore()
let locale = zhCN
dayjs.locale('zh-cn')
const colorList = [
  { color: '#1965FF', title: '默认', name: 'theme-default' },
  { color: '#409EFF', title: '蓝色', name: 'theme-blue' },
  { color: '#67C23A', title: '绿色', name: 'theme-green' },
  { color: '#FF9326', title: '橙色', name: 'theme-orange' },
  { color: '#F56C6C', title: '红色', name: 'theme-red' },
  { color: '#A126FF', title: '紫色', name: 'theme-purple' },
  { color: '#6C6F91', title: '深夜', name: 'theme-black' }
]
const calcColor = () => {
  let color = '#1965FF'
  colorList.forEach((v) => {
    if (v.name == useOem().getSiteInfo().mgr.sysPrimaryColor) {
      color = v.color
    }
  })
  return color
}
// 切换主题色
import { ConfigProvider } from 'ant-design-vue'
ConfigProvider.config({
  theme: {
    primaryColor: calcColor()
  }
})
</script>
